Skip to content

Conversation

@lanterno
Copy link
Contributor

@lanterno lanterno commented Sep 1, 2025

Description

With the merge of the last PR #17, the project is now ready to run with Rust 1.89 (latest stable version as of the time of writing).
In the PR, I update Rust version, and also update all the WASM libraries to the latest versions.

Notice the change in the script file scripts/build-package.sh where this change arises from a very subtle change in the workings of the library wasm-bindgen.
This encourages a rethink on this part of the build script to avoid future bugs.

Next steps

In the following PR, I'll update the docknetwork crypto libraries to the latest versions. In fact, this PR is a prerequisite to updating the libraries as the dependencies conflict otherwise.

PR checklist

  • Run yarn install; yarn build; yarn test to make sure everything runs as before.
  • The commit message(s) follow conventional commits
  • Documentation has been added / updated (for bug fixes / features)
  • Changes follow the contributing document.

Does this PR introduce a breaking change?

  • Yes
  • No

Which merge strategy will you use?

  • Squash
  • Rebase (REVIEW COMMITS)

@lanterno lanterno changed the title build: updates rust version and crates to latest versions build: updates rust version and WASM crates to latest versions Sep 1, 2025
@lanterno lanterno force-pushed the build/pushes-rust-version-and-crates-to-latest-versions branch from 1bff5a7 to 9ece847 Compare September 1, 2025 11:56
@lanterno
Copy link
Contributor Author

lanterno commented Sep 1, 2025

The build failed, and by some investigation, I found the reason to be the github action https://github.com/jetli/wasm-pack-action was using version 'v0.9.1'.
By replacing this with a direct instal of the latest version of wasm-pack, the build now succeeds.

@lanterno
Copy link
Contributor Author

lanterno commented Sep 1, 2025

Now, the tests fail with error

A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them.
Test Suites: 1 failed, 12 passed, 13 total
Tests:       2 skipped, 145 passed, 147 total
Snapshots:   0 total
Time:        149.43 s

I'm guessing that's because of a memory leak indeed. I don't notice this on my local machine, but I'll try to improve the tests anyway, and see if that makes a difference.

@lanterno lanterno force-pushed the build/pushes-rust-version-and-crates-to-latest-versions branch from 4f0b5ca to fd85963 Compare September 1, 2025 14:20
@lanterno
Copy link
Contributor Author

lanterno commented Sep 1, 2025

Update: Rerunning the tests with no code updates succeeded with no issues.

I'll leave this issue for now, and we can come back to this problem later after the final update of the libraries.

@lanterno lanterno force-pushed the build/pushes-rust-version-and-crates-to-latest-versions branch from fd85963 to b4e6710 Compare September 1, 2025 14:39
Cargo.toml Outdated
wasm-bindgen = "= 0.2.100"
dlmalloc = { version = "0.2.6", features = ["global"], optional = true }
serde_with = { version = "1.10.0", default-features = false, features = ["macros"] }
serde_with = { version = "3.14.0", default-features = false, features = ["macros"] }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrading this caused the serialization to change which is a breaking change so we need adapt in the TS lib (these tests specifically). The old serialized data used in those tests is here.
Is there a feature that you want from the upgraded version of this dependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrading this .... The old serialized data used in those tests is here.

Oh! It didn't come to mind to look at the crypto-wasm-ts until I finished the updates here. Now, I'm thinking maybe I need to start running the crypto-wasm-ts tests on this library today.

Is there a feature that you want from the upgraded version of this dependency?

Not really! I was just worried that it's lagging behind with 2 major versions. However, since there's no incompatibility problems raised by this so far, I can just postpone until later to avoid having many issues to solve in crypto-wasm-ts at the same time.

Cargo.toml Outdated
serde_json = { version = "1.0"}
serde-wasm-bindgen = "0.6.5"
wasm-bindgen = "= 0.2.86"
wasm-bindgen = "= 0.2.100"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar concern as with the serde_with dependency, i think upgrading it changed some serialisation but I am not that confident of my memory here. (Should have put a note for the reason of pinning it).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, this is a bit tricky as this update is needed for newer versions of rust, and also to avoid conflicting dependencies with the latest version of the crypto crates. (I've already tried updating the dock crypto crates to the latest version but this pinned version was a problem.)

I'm thinking about trying to load this library into crypto-wasm-ts and run the tests to make sure they succeed, then we can proceed on this. What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking about trying to load this library into crypto-wasm-ts and run the tests to make sure they succeed, then we can proceed on this. What do you think?

Yes, for bigger upgrades, i run crypto-wasm-ts with crypto-wasm before publishing crypto-wasm itself. I make crypto-wasm a local dependency of crypto-wasm-ts. For some reason, yarn link sometimes didn't work so I had to manually remove the dependency's directory from node_modules when I updated the dependency (crypto-wasm here)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I struggled with that a bit yesterday, until I found that new versions of yarn introduced the portal keyword, and it works like this (in your package.json file).

"crypto-wasm-new": "portal:../crypto-wasm",

This works without issues for me so far.
The link command was removed in newer versions of yarn.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Lovesh, I've worked on the crypto-wasm-ts to make sure the changes here are good (as we said above).

Now, I have this PR with the necessary changes to make everything work.
The necessary changes are in this PR docknetwork/crypto-wasm-ts#43

Note that in one commit docknetwork/crypto-wasm-ts@bed0d12 I had to remove a bunch of tests because we've removed the old proof-system dependency which means this support is gone now.

Does this look okay to you?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry again for the long delay. Will try to be quick from now on. The build failed because there is no version of crypto-wasm for 0.34.0. I have asked the concerned folks to publish

Copy link
Contributor Author

@lanterno lanterno Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lovesh No problem! thank you!

But vesion 0.34 is not needed now.. the build will keep failing until we merge this PR as the changes here are a requirement for the other PR.

I could only test locally following your suggestion here: #19 (comment)

I think the next step in my opinion is to merge this PR if it doesn't have any issues, then do the release.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, but the version 0.34 is published now. I was seeing errors in CI of this PR as

error Couldn't find any versions for "@docknetwork/crypto-wasm" that matches "0.34.0"

So after release, I re-ran that PR and now i see following error in CI as

error Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`.

My only request with this PR is that the version bump of serde-with as i am sure it will break downstream code. wasm-bindgen update might be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should go and update that PR to update to the new version.

As for this PR, the serde-with should be an easy change, specially if you feel strongly it will break downstream code 👍
I'll update you as soon as I get this done.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted the version update for serde-with but now I'm having a problem with the tests in crypto-wasm-ts.. I'll get back here once I get them fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants